<template>
    <!-- use the modal component, pass in the prop -->
    <modal v-if="stateManager.InfoDialogVisible"
           @cancel="closeDialog"
           @ok="closeDialog"
           :modal-title="modalTitle"
           model-size="normal">
        <!--
          you can use custom content here to overwrite
          default content
        -->
        <board :data-source="tableList">
            <template slot="li" slot-scope="props">
                <li class="success-element" >
                <p>学生：{{props.item.u_name}}</p>
                <p>学号：{{props.item.u_code}}</p>
                <p>成绩：{{props.item.code}}</p>
                <div class="agile-detail">
                    <a href="javascript:;" class="pull-right btn btn-xs btn-white">座次号：{{props.item.orders}}</a>
                  <p>  <i class="fa fa-clock-o"></i>{{changeTime(props.item.begin)}}--{{changeTime(props.item.end)}}</p>
                </div>
                </li>
            </template>
        </board>
    </modal>


</template>

<script>
    export default {
        props: {
            stateManager: {
                type: Object
            }
        },
        data: function () {
            return {
                years:'',
                c_name:'',
                change:false,
                list: {},
                UserCourse:[],
            };
        },
        methods: {
            changeTime:function (time) {
                return new Date(parseInt(time) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');
            },
            closeDialog: function () {
//                console.log(11);
                this.stateManager.InfoDialogVisible = false;
                this.stateManager.InfoModelId = 0;
            }
        },
        computed: {
            modalTitle: function () {
                return '参考人员列表'
            },
            tableList(){
                if (this.change) {
                    this.list.fetch();
                    this.change = false;
                }
                return this.list;
            }
        },
        watch: {
            'stateManager.InfoModelId': function (newValue) {
                let self =this;
                this.list = this.$listDataSource({
                    url: 'api/get-exam/'+self.stateManager.InfoModelId
                });
                this.change=true;
            }
        }
    }
</script>
<style>
</style>